<?php 

$engine = new stdClass();
$engine->num = 4;

$carA = new stdClass();
$carA->brand = '奔驰';
$carA->power = '汽油';
$carA->engine = $engine;

$carB = $carA;
$carB->brand = '宝马';

//使用clone
$carC = clone $carA;
$carC->brand = '五菱';
$carC->power = '电池';
$carB->engine->num = 3;

var_dump($carA);
var_dump($carB);
var_dump($carC);

